# -*- coding: utf-8 -*-

# 文件名： SocketServer—forever
# 日  期： 2023/4/17
# 你有见过洛杉矶凌晨4点的太阳和直升机上的肘击吗?
#                  —————By Black Mamba , Kobe Bryant
import socket

tcpserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpserver.bind(("192.168.1.104", 5418))
tcpserver.listen(5)
while True:
    connection, address = tcpserver.accept()
    print(connection)
    while True:
        try:
            data = connection.recv(1024)
            print(data.decode("utf-8"))
            ret_data = input("请回复：")
            connection.send(ret_data.encode('utf-8'))
        except Exception:
            break
    connection.close()
